package com.example.zhoutao.puzzle.Gaming;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Window;
import com.example.zhoutao.puzzle.History.ChildFragment;
import com.example.zhoutao.puzzle.History.Content;
import com.example.zhoutao.puzzle.History.TabNavitationLayout;
import com.example.zhoutao.puzzle.History.ViewPagerAdapter;
import com.example.zhoutao.puzzle.R;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author ZT on 2019.4.20
 *
 */

public class GameHistory extends FragmentActivity {

    private TabNavitationLayout tabNavitationLayout;
    private String[] titles = new String[]{"3X3", "4X4", "5X5", "6X6", "7X7"};
    private ViewPagerAdapter viewPagerAdapter;
    private List<Fragment> fragments;
    private ViewPager viewPager;
    private String name;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_history);
        GameMenu.activityList.add(this);
        Intent intent=getIntent();
        Bundle bundle=intent.getBundleExtra("res");
        name=bundle.getString("name");


        tabNavitationLayout=findViewById(R.id.bar);
        viewPager=findViewById(R.id.viewpager);

        Fragment S3=ChildFragment.newInstance(Content.S3,name);
        Fragment S4=ChildFragment.newInstance(Content.S4,name);
        Fragment S5=ChildFragment.newInstance(Content.S5,name);
        Fragment S6=ChildFragment.newInstance(Content.S6,name);
        Fragment S7=ChildFragment.newInstance(Content.S7,name);

        fragments=new ArrayList<>();
        fragments.add(S3);
        fragments.add(S4);
        fragments.add(S5);
        fragments.add(S6);
        fragments.add(S7);
        viewPagerAdapter=new ViewPagerAdapter(getSupportFragmentManager(),fragments);
        viewPager.setAdapter(viewPagerAdapter);

        tabNavitationLayout.setViewPager(this,titles,viewPager,R.drawable.drawable_left,R.drawable.drawable_mid,R.drawable.drawable_right,R.color.color_ffffff,R.color.color_282d31,16,0,1f,true);


    }
}
